package com.example.basic.web.controller.newly;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.example.basic.core.result.Result;
import com.example.basic.core.result.ResultGenerator;
import com.example.basic.web.model.device.Device;
import com.example.basic.web.model.newly.SysPdaFlow;
import com.example.basic.web.request.AddFlowDto;
import com.example.basic.web.request.GetDeviceDto;
import com.example.basic.web.request.HandMoveDto;
import com.example.basic.web.request.UserAffirmDto;
import com.example.basic.web.service.newly.ISysPdaFlowService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 流程Controller
 * 
 * @author zhiyun
 * @date 2025-08-08
 */
@RestController
@RequestMapping("/api/v1/byg/flow")
public class SysPdaFlowController
{
    @Autowired
    private ISysPdaFlowService sysPdaFlowService;


    /**
     * 初次添加信息
     * @param addFlowDto
     * @return
     */
    @PostMapping("/add")
    public Result<Boolean> add(@RequestBody AddFlowDto addFlowDto){
        return ResultGenerator.genSuccessResult(sysPdaFlowService.add(addFlowDto));
    }

    /**
     * 确认
     * @return
     */
    @PostMapping("/affirm")
    public Result<Boolean> affirm(@RequestBody UserAffirmDto userAffirmDto){
        return ResultGenerator.genSuccessResult(sysPdaFlowService.affirm(userAffirmDto));
    }

    /**
     * 从担架板库一到接驳台
     * @param positionId
     * @return
     */
    @GetMapping("/getDj")
    public Result<Boolean> getDj( String positionId)
    {
        return ResultGenerator.genSuccessResult(sysPdaFlowService.getDj(positionId));
    }


    /**
     * 根据类型获取设备列表
     * @param deviceDto
     * @return
     */
    @GetMapping("/getDevice")
    public Result<List<Device>> getDevice(GetDeviceDto deviceDto){
        return ResultGenerator.genSuccessResult(sysPdaFlowService.getDevice(deviceDto));
    }

    /**
     * 手动下发
     * @param handMoveDto
     * @return
     */
    @PostMapping("/handMove")
    public Result<Boolean> handMove(@RequestBody HandMoveDto handMoveDto){
        return ResultGenerator.genSuccessResult(sysPdaFlowService.handMove(handMoveDto));
    }


    /**
     * 流程干预
     * @param sysPdaFlow
     * @return
     */
    @PostMapping("/updateFlow")
    public Result<Boolean> updateFlow(@RequestBody SysPdaFlow sysPdaFlow) {
        return ResultGenerator.genSuccessResult(sysPdaFlowService.updateFlow(sysPdaFlow));
    }


}
